package connect

import (
	"database/sql"
	"time"
)

type Patient struct {
	PatientNumber int            `db:"PatientNumber" json:"PatientNumber"`
	NameDicom     string         `db:"NameDICOM" json:"NameDICOM"`
	NameLast      string         `db:"NameLast" json:"NameLast"`
	NameFirst     sql.NullString `db:"NameFirst" json:"NameFirst"`
	PatientId     sql.NullString `db:"PatientID" json:"PatientID"`
	PatientSex    sql.NullString `db:"PatientSex" json:"PatientSex"`
	BirthDate     sql.NullTime   `db:"BirthDate" json:"BirthDate"`
	OtherId       sql.NullString `db:"OtherID" json:"OtherID"`
	Comments      sql.NullString `db:"Comments" json:"Comments"`
	DeleteFlag    sql.NullBool   `db:"DeleteFlag" json:"DeleteFlag"`
	EnteredDate   time.Time      `db:"EnteredDate" json:"EnteredDate"`
	ModifiedDate  time.Time      `db:"ModifiedDate" json:"ModifiedDate"`
	PatientUid    sql.NullString `db:"PatientUID" json:"PatientUID"`
}

type Image struct {
	ImageNumber               int            `db:"ImageNumber" json:"ImageNumber"`
	SeriesNumber              sql.NullInt32  `db:"SeriesNumber" json:"SeriesNumber"`
	ClassUID                  sql.NullString `db:"ClassUID" json:"ClassUID"`
	ImageUID                  sql.NullString `db:"ImageUID" json:"ImageUID"`
	ImageNumberDICOM          sql.NullString `db:"ImageNumberDICOM" json:"ImageNumberDICOM"`
	ImageType                 sql.NullString `db:"ImageType" json:"ImageType"`
	ImageFileName             sql.NullString `db:"ImageFileName" json:"ImageFileName"`
	ImageFileVolumeNumber     sql.NullInt32  `db:"ImageFileVolumeNumber" json:"ImageFileVolumeNumber"`
	ImageSource               sql.NullInt32  `db:"ImageSource" json:"ImageSource"`
	Width                     sql.NullInt32  `db:"Width" json:"Width"`
	Height                    sql.NullInt32  `db:"Height" json:"Heiht"`
	BitsPerPixel              sql.NullInt32  `db:"BitsPerPixel" json:"BitsPerPixel"`
	SensorType                sql.NullString `db:"SensorType" json:"SensorType"`
	SensorNumber              sql.NullString `db:"SensorNumber" json:"SensorNumber"`
	SensorMode                sql.NullString `db:"SensorMode" json:"SensorMode"`
	MicronsPerPixel           sql.NullInt32  `db:"MicronsPerPixel" json:"MicronsPerPixel"`
	MicronsPerPixelCalibrated sql.NullInt32  `db:"MicronsPerPixelCalibrated" json:"MicronsPerPixelCalibrated"`
	ImageDate                 sql.NullTime   `db:"ImageDate" json:"ImageDate"`
	AcquiredDate              sql.NullTime   `db:"AcquiredDate" json:"AcquredDate"`
	CalibratedDate            sql.NullTime   `db:"CalibratedDate" json:"CalibratedDate"`
	Rotation                  sql.NullInt16  `db:"Rotation" json:"Rotation"`
	HorizontalFlip            bool           `db:"HorizontalFlip" json:"HorizontalFlip"`
	Laterality                sql.NullString `db:"Laterality" json:"Laterality"`
	AnatomicRegion            sql.NullString `db:"AnatomicRegion" json:"AnatomicRegion"`
	AnatomicRegionModifier    sql.NullString `db:"AnatomicRegionModifier" json:"AnatomicRegionModifier"`
	AnatomicStructure         sql.NullString `db:"AnatomicStructure" json:"AnatomicStructure"`
	AnatomicStructureModifier sql.NullString `db:"AnatomicStructureModifier" json:"AnatomicStructureModifier"`
	Comments                  sql.NullString `db:"Comments" json:"Comments"`
	Exported                  bool           `db:"Exported" json:"Exported"`
	Imported                  bool           `db:"Imported" json:"Imported"`
	DeleteFlag                bool           `db:"DeleteFlag" json:"DeleteFlag"`
	EnteredDate               time.Time      `db:"EnteredDate" json:"EnteredDate"`
	ModifiedDate              time.Time      `db:"ModifiedDate" json:"ModifiedDate"`
	TransferSyntax            sql.NullString `db:"TransferSyntax" json:"TransferSyntax"`
	FileSize                  sql.NullInt32  `db:"FileSize" json:"FileSize"`
}

type Study struct {
	StudyNumber        int            `db:"StudyNumber" json:"StudyNumber"`
	PatientNumber      sql.NullInt32  `db:"PatientNumber" json:"PatientNumber"`
	StudyUID           sql.NullString `db:"StudyUID" json:"StudyUID"`
	StudyDate          sql.NullTime   `db:"StudyDate" json:"StudyDate"`
	StudyID            sql.NullString `db:"StudyID" json:"StudyID"`
	AccessionNumber    sql.NullString `db:"AccessionNumber" json:"AccessionNumber"`
	Description        sql.NullString `db:"Description" json:"Description"`
	Comments           sql.NullString `db:"Comments" json:"Comments"`
	ReferringPhysician sql.NullString `db:"ReferringPhysician" json:"ReferringPhysician"`
	ViewSetUID         sql.NullString `db:"ViewSetUID" json:"ViewSetUID"`
	ViewSetNumber      sql.NullInt32  `db:"ViewSetNumber" json:"ViewSetNumber"`
	Exported           bool           `db:"Exported" json:"Exported"`
	Imported           bool           `db:"Imported" json:"Imported"`
	DeleteFlag         bool           `db:"DeleteFlag" json:"DeleteFlag"`
	EnteredDate        time.Time      `db:"EnteredDate" json:"EnteredDate"`
	ModifiedDate       time.Time      `db:"ModifiedDate" json:"ModifiedDate"`
}

type Series struct {
	SeriesNumber      int            `db:"SeriesNumber" json:"SeriesNumber"`
	StudyNumber       sql.NullInt32  `db:"StudyNumber" json:"StudyNumber"`
	Modality          sql.NullString `db:"Modality" json:"Modality"`
	SeriesUID         sql.NullString `db:"SeriesUID" json:"SeriesUID"`
	SeriesNumberDICOM sql.NullString `db:"SeriesNumberDICOM" json:"SeriesNumberDICOM"`
	SeriesDate        sql.NullTime   `db:"SeriesDate" json:"SeriesDate"`
	PhysicianName     sql.NullString `db:"PhysicianName" json:"PhysicianName"`
	OperatorName      sql.NullString `db:"OperatorName" json:"OperatorName"`
	SeriesDescription sql.NullString `db:"SeriesDescription" json:"SeriesDescription"`
	BodyPart          sql.NullString `db:"BodyPart" json:"BodyPart"`
	Exported          bool           `db:"Exported" json:"Exported"`
	Imported          bool           `db:"Imported" json:"Imported"`
	DeleteFlag        bool           `db:"DeleteFlag" json:"DeleteFlag"`
	EnteredDate       sql.NullTime   `db:"EnteredDate" json:"EnteredDate"`
	ModifiedDate      sql.NullTime   `db:"ModifiedDate" json:"ModifiedDate"`
}

type ImageFile struct {
	ImageAdress string `json:"ImageAdress"`
	ImageNumber string `json:"ImageNumber"`
	ImageCode   int    `json:"ImageCode"`
	ImageDate   string `json:"ImageDate"`
}

type Scheme struct {
	SchemeID   string                 `json:"SchemeId"`
	SchemeName string                 `json:"SchemeName"`
	SchemeDate string                 `json:"SchemeDate"`
	Teeth      map[string][]ImageFile `json:"ImageList"`
	Label      string                 `json:"label"`
}

type PatientFile struct {
	PatientId        string   `json:"PatientId"`
	PatientNameLast  string   `json:"PatientNameLast"`
	PatientNameFirst string   `json:"PatientNameFirst"`
	PatientDR        string   `json:"PatientDR"`
	SchemeList       []Scheme `json:"SchemeList"`
}
